﻿@{
    ViewBag.Title = "用户信息";
    Layout = "~/Areas/WeiXinAreas/Views/Shared/_LayoutWeui.cshtml";
}
@*<div class="weui-cells__title">完善用户信息，已经存在，请<a href="login">绑定</a></div>*@
<div class="weui-cells weui-cells_form">
    <form id="form1">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label for="" class="weui-label">系统账号</label></div>
            <div class="weui-cell__bd">
                @ViewData["accout"]
                @*<input id="F_UserPassword" name="F_UserPassword" type="password" class="weui-input required" placeholder="系统账号" />*@
            </div>
            <div class="weui-cell__ft">
                <i class="weui-icon-warn"></i>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label for="" class="weui-label">姓&nbsp;&nbsp;名</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" id="F_RealName" name="F_RealName" type="text" placeholder="请输入姓名" value="@ViewData["F_RealName"]" required>
            </div>
            <div class="weui-cell__ft">
                <i class="weui-icon-warn"></i>
            </div>
        </div>
        @*<div class="weui-cell">
            <div class="weui-cell__hd"><label for="" class="weui-label">身份证号</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" id="F_DepartmentId" name="F_DepartmentId" type="text" placeholder="请输入身份证号">
            </div>
            <div class="weui-cell__ft">
                <i class="weui-icon-warn"></i>
            </div>
        </div>*@
        <div class="weui-cell">
            <div class="weui-cell__hd"><label for="" class="weui-label">联系电话</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" id="F_MobilePhone" name="F_MobilePhone" type="tel" value="@ViewData["F_MobilePhone"]" placeholder="请输入手机号">
            </div>
            <div class="weui-cell__ft">
                <i class="weui-icon-warn"></i>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label for="" class="weui-label">收件地址</label>
            </div>
            <div class="weui-cell__bd" style="text-align:right;">
                @*<input id="F_Birthday" class="weui-input" name="F_DepartmentId" value="@ViewData["F_DepartmentId"]" type="text" placeholder="请输入收件地址" />*@
                <a href="Address">
                    <img src="~/Content/M/img/join.png" style="width:36px;" />
                </a>
            </div>
        </div>
        @*<div class="weui-cell weui-cell_switch">
            <div class="weui-cell__hd"><label for="" class="weui-label">性&nbsp;&nbsp;别</label></div>
            <div class="weui-cell__bd">男</div>
            <div class="weui-cell__ft">
                <label for="F_Gender" class="weui-switch-cp">
                    <input id="F_Gender" name="F_Gender" class="weui-switch-cp__input" checked="" onchange="changsex()" type="checkbox">
                    <div class="weui-switch-cp__box"></div>
                </label>
            </div>
        </div>*@
       @* <div class="weui-cell">
    <div class="weui-cell__bd">
        <textarea class="weui-textarea" id="F_Description" name="F_Description" placeholder="请输入备注" rows="3"></textarea>
        <div class="weui-textarea-counter"><span>0</span>/200</div>
            </div>
        </div>*@
        <div class="weui-cell">
            <a href="javascript:submit();" class="weui-btn weui-btn_primary">修    改<i class="weui-loading" style="display:none;"></i></a>
        </div>
    </form>
</div>
@section footScript
{
    <script type="text/javascript">
        var sendflag = false;
        //$(function () {
        //    $("#F_Birthday").calendar();
        //});
        //function changsex() {
        //    $('#F_Gender').parent().parent().prev().text($('#F_Gender').prop('checked') ? "男" : "女");
        //}
        function submit() {
            if (sendflag)
                return;
            sendflag = true;
            if (yan() != false) {
                $(".weui-loading").show();
                $.ajax({
                    url: "submitSetUserInfo",
                    data: $("#form1").serialize(),
                    dataType: 'text',
                    type: 'post',
                    success: function (_data) {
                        if (_data.toString().indexOf("success") > -1) {
                            $.alert(_data.substr(8));
                            window.location.replace("Ponser");
                        }
                        else {
                            $.alert(_data.substr(6));
                        }
                        $(".weui-loading").hide();
                        sendflag = false;
                    }
                });
            }
            else {
                sendflag = false;
            }
        }
        function yan() {
            //if ($("#F_UserPassword").val().length < 6) {
            //    $("#F_UserPassword").parent().parent().addClass("weui-cell_warn");
            //    $.alert("密码长度不能小于六位!");
            //    return false;
            //}
            //else {
            //    $("#F_UserPassword").parent().parent().removeClass("weui-cell_warn");
            //}

            if ($("#F_RealName").val() == "") {
                $("#F_RealName").parent().parent().addClass("weui-cell_warn");
                $.alert("请输真实姓名!");
                return false;
            }
            else {
                $("#F_RealName").parent().parent().removeClass("weui-cell_warn");
            }

            //var card = $("#F_DepartmentId");
            //if (card.val() == "") {
            //    card.parent().parent().addClass("weui-cell_warn");
            //    $.alert("请输入收货地址!");
            //    return false;
            //}
            //else if (!(/^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$/.test(card.val()))) {
            //    card.parent().parent().addClass("weui-cell_warn");
            //    $.alert("身份证号码有误，请重填!");
            //    return false;
            //}
            //else {
            //    card.parent().parent().removeClass("weui-cell_warn");
            //}

            var haoma = $('#F_MobilePhone');
            if (haoma.val() == "") {
                haoma.parent().parent().addClass("weui-cell_warn");
                $.alert("请输入手机号码!");
                return false;
            }
            else if (!(/^1[34578]\d{9}$/.test(haoma.val()))) {
                haoma.parent().parent().addClass("weui-cell_warn");
                $.alert("手机号码有误，请重填!");
                return false;
            }
            else {
                haoma.parent().parent().removeClass("weui-cell_warn");
            }
            //
            return true;
        }
    </script>
}
